import Vue from 'vue';
import Router from 'vue-router';
// import { resolve } from 'uri-js';
// import concentrator from '../components/NB/meterReadingManagement/concentrator.vue';
// import collection from '../components/NB/meterReadingManagement/collection.vue';

// 懒加载方式，当路由被访问的时候才加载对应组件
//const Login = resolve => require(['@/components/Login'], resolve)

Vue.use(Router);

const router = new Router({
    routes: [
        // 主页面
        {
            path: '/',
            name: 'mainPage',
            component: resolve => require(['../components/NB/mainPage.vue'], resolve),
            meta: {
                title: '主页面'
            },
        },
        // 户表管理
        {
            path: '/NB/meterPage',
            name: 'meterPage',
            component: resolve => require(['../components/NB/NBMeterManagement/home.vue'], resolve),
            meta: {
                title: '户表管理'
            },
            hidden: true
        },
        // 设备管理
        {
            path: '/NB/devicePage',
            name: 'devicePage',
            component: resolve => require(['../components/NB/devicePage.vue'], resolve),
            meta: {
                title: '设备管理'
            },
        },
        {
            path: '/NB/waterMonitoring',
            name: 'waterMonitoring',
            component: resolve => require(['../components/NB/waterMonitoring.vue'], resolve),
            meta: {
                title: '水质监测'
            },
        },
        {
            path: '/404',
            name: '404',
            component: resolve => require(['../components/404.vue'], resolve)
        },
        {
            path: '/403',
            name: '403',
            component: resolve => require(['../components/403.vue'], resolve)
        },
        {
            path: '*', // 路由错误
            redirect: '/404' // 重定向
        }
    ]
})

// 导出
export default router;
